{layout name="layouts/admin" /}
<div class="panel-heading">奖品列表
   <a style="float:right;margin-top:-6px;" href="/prize/add" class="btn btn-primary">添加奖品</a>
   <a style="float:right;margin-right:10px;margin-top:-6px;" onclick="prizeexort()" href="javascript:void(0)" class="btn btn-primary">导出奖品列表</a>
</div>

<div class="panel-body">
    <div class="box-body">
        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
            <div class="row">
                <form action="/prize/list" method="post" style="margin-bottom: 20px;">
                    <input type="text" class="form-control" style="width:250px;" value="{$keywords}" id="keywords" name="keywords" placeholder="请请输入奖品名或赞助商名或发起人"/>
                    <select name="prizesource" id="prizesource" class="form-control" >
                        <option value="-1" {$prizesource==-1?"selected":""}>全部</option>
                        <option value="0" {$prizesource==0?"selected":""}>个人</option>
                        <option value="1" {$prizesource==1?"selected":""}>公司</option>
                    </select>
                    <select name="prizeisopen" id="prizeisopen" class="form-control" >
                        <option value="-1" {$prizeisopen==-1?"selected":""}>全部</option>
                        <option value="0" {$prizeisopen==0?"selected":""}>未开奖</option>
                        <option value="1" {$prizeisopen==1?"selected":""}>已开奖</option>
                    </select>
                    <input type="submit" value="搜索" class="btn btn-primary"/>
                </form>
                <div class="col-sm-12">
                    <table class="table table-hover dataTable" >
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>奖品标题</th>
                            <th>赞助商/发起人</th>
                            <th>数量</th>
                            <th>类型</th>
                            <th>来源</th>
                            <th>开奖方式</th>
                            <th>是否开奖</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach $prizelist as $prize}
                        <tr>
                            <td  style="width:5%">{$prize.id}</td>
                            <td style="width:20%">{$prize.prize_title}</td>
                            <td style="width:10%">{$prize.sp_name}</td>
                            <td style="width:2%">{$prize.prize_num}</td>
                            <td style="width:5%">{$prize.prize_type==0?'单人':'组团'}</td>
                            <td style="width:10%">{$prize.sponsor_id?'公司':'个人'}</td>
                            <td style="width:10%">{$prize.full_num?'按人数开奖':'按时间开奖'}</td>
                            <td style="width:10%">{$prize.is_open?'已开奖':'未开奖'}</td>
                            <td style="width:13%">{$prize.create_time|date="Y-m-d H:i"}</td>
                            <td style="width:15%">
                                {if $prize.is_open!=1}
                                <a href="/prize/add/{$prize.id}"><i class="fa fa-pencil fa-fw" style="font-size: 20px;" title="编辑"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                {/if}
                                {if $prize.is_open==1}
                                <a href="/prize/winners/{$prize.id}"><i class="fa fa-list-ul" style="font-size: 20px;" title="中奖人列表"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                {/if}
                                {if $prize.is_open!=1}
                                <a href="/prize/delete/{$prize.id}" onclick="return confirm('确定要删除该奖品么？请慎重操作!!!')"><i class="fa fa-trash-o fa-lg" style="font-size: 20px;" title="删除"></i></a>
                                {/if}
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                    <div class="col-sm-7" style="float: right">
                        {php}echo trim($prizelist->render(),'"');{/php}
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-9 ">
                    {$prizelist[0]?"":"暂无数据"}
                </div>

            </div>
        </div>
    </div>

</div>

<script>
    function prizeexort() {
        var keyword=$("#keywords").val();
        var prizesource=$("#prizesource").val();
        var prizeisopen=$("#prizeisopen").val();
        window.location.href="/prize/prizeexport?keyword="+keyword+"&prizesource="+prizesource+"&prizeisopen="+prizeisopen;
    }
</script>